<?php

require_once 'phpmoko/ui/Panel.php';
require_once 'phpmoko/ui/RootPanel.php';

class ListPanel extends Panel
{
	private $tag = 'ul';

	function __construct()
	{
		parent::__construct();
		
		$this->id = RootPanel::getUniqueId();
	}

	function setNumericActive($enabled)
	{
		if ($enabled)
			$this->tag = 'ol';
		else
			$this->tag = 'ul';
	}
	
	function getTag()
	{
		return $this->tag;
	}
	
	function toString()
	{
		$str = '<'.$this->tag;

		if ($this->id != null)
			$str .= ' id="'.$this->id.'"';

		$str .= '>';

		foreach ($this as $widget)
		{
			$str .= '<li';

			if ($widget->style != null)
				$str .= ' class="'.$widget->style.'"';

			$str .= '>'.$widget->toString().'</li>';
		}

		$str .= '</'.$this->tag.'>';

		return $str;
	}
}
?>